<!DOCTYPE html>
<html>
<head>
    <title></title>
		<#include "/header.html">
</head>
<style>
    .el-upload__input {
        display: none !important;
    }
</style>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div style="float: left;height:34px;line-height:34px;">商品名称：</div>
            <div style="float: left;">
                <input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="请输入内容">
            </div>
            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">商品分类：</div>
            <div style="float: left;width:160px;margin-right: 10px;">
                <select class="form-control" v-model="q.categoryid" @keyup.enter="query" id="category_id">

                </select>
            </div>

            <a class="btn btn-primary" @click="query">查询</a>
			<#if shiro.hasPermission("sys:product:save")>
            <a class="btn btn-primary" @click="add">&nbsp;新增商品</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span style="color: red">*</span>条形码</div>
                            <div class="col-sm-10" @click="getBarcode" style="width:35%;padding-right:6px;">
                                <label class="radio-inline">
                                    <input type="radio" name="barcode" value="1"/> 有条形码
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="barcode" value="2" checked="checked"/> 无条形码
                                </label>

                            </div>
                            <div class="col-sm-10" hidden="true" id="barcode" style="width: 190px;">
                                <input type="text" class="form-control" v-model="product.barcode" placeholder="输入商品条形码"/>
                            </div>
                        </div>
														                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>商品名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.productname" placeholder="商品名称"/>
                        </div>
                    </div>

											                    <div class="form-group">
                        <div class="col-sm-2 control-label">商品描述</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.productdesc" placeholder="商品描述"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>单位</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.unit" placeholder="单位"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>成本价</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.costprice" placeholder="商品成本价"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>销售价</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.sellprice" placeholder="商品销售价"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">商品图片</div>
                        <div class="col-sm-10">
                            <el-upload
                                    class="upload-demo"
                                    action="http://localhost:8081/renren-api/api/file/uploadfile"
                                    :on-preview="handlePreview"
                                    :on-remove="handleRemove1"
                                    :file-list="fileList1"
                                    :on-success="handsuccess1"
                                    list-type="picture">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>

                            <input type="text" class="form-control" v-model="product.productimg" style="display: none;"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">商品分组</div>
                        <div class="col-sm-10" id="group">


                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>货架库存预警</div>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="stockwarning" v-model="product.stockwarning" value="0"/> 启用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="stockwarning" v-model="product.stockwarning" value="1"/> 禁用
                            </label>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>库存上限</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.upperlimit" placeholder="库存上限"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>库存下限</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.lowerlimit" placeholder="库存下限"/>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>是否支持外卖</div>
                        <div class="col-sm-10" @click="takeOut">
                            <label class="radio-inline">
                                <input type="radio" name="istackout" v-model="product.istackout" value="0"/> 启用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="istackout" v-model="product.istackout" value="1"/> 禁用
                            </label>
                        </div>
                    </div>
											                    <div class="form-group" hidden="true" id="outprice">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>外卖售价</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.outprice" placeholder="外卖售价"/>
                        </div>
                    </div>
											                    <div class="form-group" hidden="true" id="infinitestock">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>无限库存</div>
                        <div class="col-sm-10" @click="infiniteStock">
                            <label class="radio-inline">
                                <input type="radio" name="infinitestock" v-model="product.infinitestock" value="0"/> 启用
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="infinitestock" v-model="product.infinitestock" value="1"/> 禁用
                            </label>
                        </div>
                    </div>
											                    <div class="form-group" hidden="true" id="outstock">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>外卖库存</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="product.outstock" placeholder="外卖库存"/>
                        </div>
                    </div>
							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="${request.contextPath}/statics/js/modules/sys/product.js?_${.now?long}"></script>
</body>
</html>